#include "glVector.h"

glVector::glVector()
{
	i = j = k = m_Mag = 0.0f;										
}

glVector::~glVector()
{

}


void glVector::operator *=(GLfloat scalar)
{
	i *= scalar;
	j *= scalar;
	k *= scalar;
}

GLfloat glVector::Magnitude()
{
	GLfloat result; 
	
	result = GLfloat(sqrt(i * i + j * j + k * k));
	m_Mag = result;
	return(result);
}

void glVector::Normalize()
{
	if(m_Mag != 0.0f)
	{
		i /= m_Mag;
		j /= m_Mag;
		k /= m_Mag;

		Magnitude();
	}
}

glVector glVector::operator *(GLfloat scalar)
{
	glVector r;

	r.i = i * scalar;
	r.j = j * scalar;
	r.k = k * scalar;

	return(r);
}

glVector glVector::operator +(glVector v)
{
	glVector r;

	r.i = i + v.i;
	r.j = j + v.j;
	r.k = k + v.k;

	return(r);
}

void glVector::operator =(glVector v)
{
	i = v.i;
	j = v.j;
	k = v.k;
	m_Mag = v.m_Mag;
}
